-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mask with NaNs in the raw view as well #1558
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as you tried it out (including switching to different views), then it looks good to me!
@psavery Marking as WIP for now, I'm getting bugs in testing. I'll tag you again once they're fixed. |
@psavery @saransh13 Using NaNs in the raw view requires that all raw image data be floats. Will there be issues if we cast data to float? |
I think we implicitly assume floats for all our other operations, so I
don’t see a problem doing that. Some testing should tell if that’s not the
case.
…On Tue, Aug 8, 2023 at 8:09 AM Brianna Major ***@***.***> wrote:
@psavery <https://github.com/psavery> @saransh13
<https://github.com/saransh13> Using NaNs in the raw view requires that
all raw image data be floats. Will there be issues if we cast data to float?
—
Reply to this email directly, view it on GitHub
<#1558 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADYZ2U6VA267PDE53VQ2RGDXUJJDNANCNFSM6AAAAAA3IO3EJM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@psavery This "fixes" the issue... although I'm not sure if it is the solution we want. Right now, before masking, we check to see if the image data type in integer and we cast it to float if it is. Should this maybe just automatically happen on image load so we only store the raw image data as floats? |
@bnmajor I'll check on this in more detail soon. Maybe one solution would be to used a masked array instead, and different parts of the code can treat the mask differently (like the raw image viewer can convert the masked array to a plain array with nans). Or maybe matplotlib accepts masked arrays, and we can just set the fill value to |
So here are the places where that
If we modify the output of Alternatively, I think we can do something else that will require less checking. Can we take the logic in Then, in the image canvas code here, we can return That's just a possibility for a less-invasive change. We can still modify the output of By the way, about the masked arrays, it looks like you can't set a fill value of |
Is this ready for merge? |
9a2bfc9
to
7569db0
Compare
Pending review after my latest changes it should be! |
The default behavior of create_masked_images_dict is the same as masked_images_dict, but with the additional option to set the fill value for the mask. If the fill type and mask type do not match the image will be cast to the correct type. Signed-off-by: Brianna Major <[email protected]>
Signed-off-by: Patrick Avery <[email protected]>
I made some minor modifications. I think it looks good other than one thing: the panel buffer regions should also have |
Should this change be a part of this PR or part of another one where we've re-thought how to better mesh panel buffers with the masking tools? |
In the polar view, the panel buffer values are already nans. We might want to go ahead and do it here too for consistency. Or it can be in another PR. What do you think, @saransh13? |
Let’s go ahead and do it in this PR.
…On Wed, Oct 11, 2023 at 10:02 AM Patrick Avery ***@***.***> wrote:
In the polar view, the panel buffer values are already nans. We might want
to go ahead and do it here too for consistency. Or it can be in another PR.
What do you think, @saransh13 <https://github.com/saransh13>?
—
Reply to this email directly, view it on GitHub
<#1558 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADYZ2UYDDQ3BVMOXNCNY7QTX63GMFANCNFSM6AAAAAA3IO3EJM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Now, any pixels in the panel buffers are displayed as `np.nan` in the raw view as well. Signed-off-by: Patrick Avery <[email protected]>
Ensure that a rerender occurs when the panel buffer is modified. Signed-off-by: Patrick Avery <[email protected]>
@psavery pushed the additional changes we need, the branch looks good in my testing ✅ |
Fixes #1555